package com.controller.Fxy;
import com.bean.Fxy.Fangwutianja;
import com.dao.Fxy.FangwData;
import com.service.FxyService.FwService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.sql.SQLException;

@Controller
    public class FangwTcontroller {
        /**
         * 显示页面
         */
        @Autowired
        private FwService ah;
        @ResponseBody
        @RequestMapping(value = "/Afei/getye",method = RequestMethod.POST)
        public Object conxinshi(){

            return ah.xianshiserver();
        }

        /**
         * 删除
         * @param hid
         * @return
         */
        @ResponseBody
        @RequestMapping(value = "/Afei/getshanc",method = RequestMethod.GET)

        public Object conshnahu(int hid) throws SQLException {
            return ah.servershanchu(hid);
        }

        /**
         * 楼宇下拉框获取值
         * @return
         */
        @RequestMapping(value = "/Afei/getlouyiuxiala",method = RequestMethod.GET)
        @ResponseBody
        public Object connlyxl(){

            return ah.serverlouyuxl();
        }

        /**
         * 单元下拉框获取值
         * @return
         */
        @RequestMapping(value = "/Afei/gatdanyuan",method = RequestMethod.POST)
        @ResponseBody
        public Object conndyxl( String lyxl){

            return ah.serverdanyuanxl(Integer.parseInt(lyxl));
        }

        /**
         * 住户下拉框获取值
         * @return
         */
        @RequestMapping(value = "/Afei/getzhuhiuxiala",method = RequestMethod.GET)
        @ResponseBody
        public Object connzhxl(){

            return ah.serverzhuhuxl();
        }

        /**
         * 添加
         * @param houses
         * @return
         */
        @RequestMapping(value = "/Afei/getyianj",method = RequestMethod.POST)
        @ResponseBody
        public Object conntj(Fangwutianja houses){
            System.out.println(houses.getDyxl());
            return ah.servertj(houses);
        }

        /**
         * 确认修改
         * @param houses
         * @return
         */
        @RequestMapping(value = "/Afei/getixg",method = RequestMethod.POST)
        @ResponseBody
        public Object conxiugai(Fangwutianja houses){

            return ah.serverxiugia(houses);
        }

        /**
         * 修改页面赋值
         * @param td2
         * @return
         */
        @RequestMapping(value = "/Afei/getxg1",method = RequestMethod.GET)
        @ResponseBody
        public Object conxiugai(int td2){

            return ah.serverxg(td2);
        }

        /**
         *
         */

        /**
         *综合查询
         * @return
         */
        @RequestMapping(value = "/Afei/selecthoses",method = RequestMethod.POST)
        @ResponseBody
        public Object conxiugai(String lycx,String ducx){

            return ah.serverxg(Integer.parseInt(lycx),Integer.parseInt(ducx));
        }


    }


